home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Communication
/
LibraryOfCongress
/
Source
/
MyMenuCell.m
< prev
next >
Wrap
Text File
|
1994-05-23
|
1KB
|
58 lines
#import "MyMenuCell.h"
#import <appkit/appkit.h>
@implementation MyMenuCell
fixItem(p) char *p; {
int nl=1;
char *l = p;
squishblank(p);
while (*p){
if (*p==':' && nl && p[1])
p[1]='\t', nl=0;
else
if (*p=='\n') nl=1;
p++;
}
}
- click:sender {
char buf[80000], *p = buf;
if (getItem(buf,n)){
if (strncmp(p,"\n(Record",8)==0) p = index(p,')')+1;
fixItem(p);
setText(p);
}
return self;
}
- setStringValueNoCopy:(char *)s {
[super setStringValue:s];
[self setLeaf:YES];
[self setAction:@selector(click:)];
[self setTarget:self];
return self;
}
static id f = (id)0;
- setContents:(int)N {
extern char *nthItem();
extern int nthItemIndex();
if (!f) f = [Font newFont:"Courier" size:12.];
[self setFont:f];
[super setStringValueNoCopy:s=nthItem(N)];
n = nthItemIndex(N);
return self;
}
- setStringValue: (char *)s {
return [self setStringValueNoCopy:s];
}
- (char *)stringValue {
return s;
}
@end